package com.androidx.p013lv.invention.adapter;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.androidx.p013lv.base.bean.InventionThreeBean;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.listener.ItemClickListener;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.invention.C1069R;

/* renamed from: com.androidx.lv.invention.adapter.AdapterStar */
public class AdapterStar extends BaseRecyclerAdapter<InventionThreeBean, Holder> {
    String domain;

    public void setDomain(String str) {
        this.domain = str;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((InventionThreeBean) this.list.get(i), i);
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(C1069R.C1074layout.item_star, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.androidx.lv.invention.adapter.AdapterStar$Holder */
    public class Holder extends BaseRecyclerHolder {
        AdapterStarItem adapter;
        Button btn_sum;
        ImageView iv_attention;
        ImageView iv_cover;
        RecyclerView recycler;
        TextView tv_name;

        public Holder(View view) {
            super(view);
            this.recycler = (RecyclerView) view.findViewById(C1069R.C1072id.recycler);
            ImageView imageView = (ImageView) view.findViewById(C1069R.C1072id.iv_cover);
            this.iv_cover = imageView;
            imageView.setOnClickListener(this);
            this.tv_name = (TextView) view.findViewById(C1069R.C1072id.tv_name);
            Button button = (Button) view.findViewById(C1069R.C1072id.btn_sum);
            this.btn_sum = button;
            button.setOnClickListener(this);
            ImageView imageView2 = (ImageView) view.findViewById(C1069R.C1072id.iv_attention);
            this.iv_attention = imageView2;
            imageView2.setOnClickListener(this);
        }

        public void setData(InventionThreeBean inventionThreeBean, int i) {
            if (inventionThreeBean.getHeadImg() == null || TextUtils.isEmpty(inventionThreeBean.getHeadImg())) {
                this.iv_cover.setImageResource(C1069R.C1071drawable.base_ic_default);
            } else {
                GlideUtils.loadCirclePicHead(AdapterStar.this.domain + inventionThreeBean.getHeadImg(), this.iv_cover);
            }
            this.tv_name.setText(inventionThreeBean.getContentName());
            if (inventionThreeBean.isAttention()) {
                this.iv_attention.setImageResource(C1069R.C1071drawable.ic_star_attention_no);
            } else {
                this.iv_attention.setImageResource(C1069R.C1071drawable.ic_star_attention);
            }
            RecyclerView recyclerView = this.recycler;
            recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext(), 0, false));
            AdapterStarItem adapterStarItem = new AdapterStarItem(inventionThreeBean.getVideoList(), AdapterStar.this.domain);
            this.adapter = adapterStarItem;
            this.recycler.setAdapter(adapterStarItem);
            this.adapter.setItemListener(new ItemClickListener() {
                /* class com.androidx.p013lv.invention.adapter.AdapterStar.Holder.C11241 */

                @Override // com.androidx.p013lv.base.listener.ItemClickListener
                public void onItemClick(View view, int i) {
                    ((BaseActivity) view.getContext()).startVideoPlay(((VideoBean) Holder.this.adapter.getDataInPosition(i)).getVideoId());
                }
            });
        }
    }
}
